import Vue from 'vue'
import App from './App.vue'
// 引入路由
import router from '@/router';
import TypeNav from '@/components/TypeNav';
import Carousel from '@/components/Carousel';
import Pagination from '@/components/Pagination';
// 引入仓库
import store from '@/store';
// 引入轮播图的css
import 'swiper/css/swiper.css';
// 让mockServe执行一次
import '@/mock/mockServe';
// 按需引入
import { MessageBox } from 'element-ui';
// 懒加载
import VueLazyload from 'vue-lazyload';
import * as API from '@/api';
import lazyloadImg from '@/assets/lazyload.png'
Vue.config.productionTip = false;
// 注册三级联动导航全局组件
Vue.component(TypeNav.name,TypeNav);
// 注册轮播图全局组件
Vue.component(Carousel.name,Carousel);
// 注册分页
Vue.component(Pagination.name,Pagination);
// element组件注册
Vue.prototype.$msgbox  = MessageBox;
Vue.prototype.$alert = MessageBox.alert;
Vue.use(VueLazyload, {
  preLoad: 1,
  error: lazyloadImg,
  loading: lazyloadImg,
  attempt: 5,
})


// 引入表单校验插件
import "@/plugins/validate";
// Vue.use(myPlugins);
new Vue({
  render: h => h(App),
  router,
  store,
  beforeMount(){
    Vue.prototype.$bus = this;
    Vue.prototype.$API = API;
  }
}).$mount('#app')